<?php


namespace App\Engine;


use App\Http\Controllers\Controller;

use App\Http\service\AuthService;
use App\Http\service\TableService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

class BaseController extends Controller
{
    public $page;
    public $limit;
    public $post;
    public $get;
    public $request;
    public static $requests;
    public $table;


    public function __construct(Request $request)
    {
        $post=$request->post();
        $this->request=$request;
        BaseController::$requests=$request;
        $this->get=$request->input();
        $method=$request->method();
        $this->post=$post;

        if($method=="PUT"){
            $this->post=$this->get;
        }

        if(isset($this->post["table"])){
            $this->table=$this->Table();
        }


    }

    public function getAuthService():AuthService
    {
        return new AuthService();
    }

    public function Table():TableService
    {
        return new TableService($this->post);
    }
}
